package com.acwing.partition9;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author `RKC`
 * @date 2021/12/7 15:53
 */
public class AC888求组合数IV {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int a = Integer.parseInt(s[0]), b = Integer.parseInt(s[1]);
        List<Integer> res = combination(a, b);
        for (int i = res.size() - 1; i >= 0; i--) writer.write(String.valueOf(res.get(i)));
        writer.write("\n");
        writer.flush();
    }

    private static List<Integer> combination(int a, int b) {
        //线性筛进行预处理
        List<Integer> primes = rangePrimes(a);
        List<Integer> sums = new ArrayList<>();
        for (int prime : primes) {
            //记录对应质数的次数，把结果相同的因子数去除掉
            sums.add(primesCount(a, prime) - primesCount(b, prime) - primesCount(a - b, prime));
        }
        //高精度乘法
        List<Integer> res = new ArrayList<>();
        res.add(1);
        for (int i = 0; i < primes.size(); i++) {
            for (int j = 0; j < sums.get(i); j++) {
                res = multiply(res, primes.get(i));
            }
        }
        return res;
    }

    private static List<Integer> multiply(List<Integer> nums, int p) {
        //高精度乘法
        List<Integer> answer = new ArrayList<>();
        int t = 0;
        for (Integer num : nums) {
            t += num * p;
            answer.add(t % 10);
            t /= 10;
        }
        while (t != 0) {
            answer.add(t % 10);
            t /= 10;
        }
        return answer;
    }

    private static int primesCount(int n, int p) {
        //统计n!的质因数p出现的次数
        int res = 0;
        while (n != 0) {
            res += n / p;
            n /= p;
        }
        return res;
    }

    private static List<Integer> rangePrimes(int n) {
        List<Integer> primes = new ArrayList<>(n + 10);
        boolean[] isNotPrimes = new boolean[n + 10];
        for (int i = 2; i <= n; i++) {
            if (!isNotPrimes[i]) primes.add(i);
            for (int j = 0; primes.get(j) <= n / i; j++) {
                isNotPrimes[i * primes.get(j)] = true;
                if (i % primes.get(j) == 0) break;
            }
        }
        return primes;
    }
}
